.TH "frovedis::ell_matrix<T,I>" "" "" "" ""
.SH NAME
.PP
\f[C]frovedis::ell_matrix<T,I>\f[] \- A two\-dimensional row\-wise
distributed ELL sparse matrix.
.SH SYNOPSIS
.PP
\f[C]#include\ <frovedis/matrix/ell_matrix.hpp>\f[]
.SS Constructors
.PP
ell_matrix ();
.PD 0
.P
.PD
ell_matrix (\f[C]crs_matrix<T,I,O>\f[]& m);
.SS Public Member Functions
.PP
void debug_print ();
.PD 0
.P
.PD
\f[C]crs_matrix<T,I,O>\f[] to_crs();
.SS Public Data Members
.PP
\f[C]frovedis::node_local<ell_matrix_local<T,I>>\f[] data;
.PD 0
.P
.PD
size_t num_row;
.PD 0
.P
.PD
size_t num_col;
.SH DESCRIPTION
.PP
A ELL matrix is one of the most popular sparse matrices with elements
stored in column\-major order.
In this matrix representation, all the non\-zero elements of a row are
shifted (packed) at left side and all the rows are padded with zeros on
the right to give them equal length.
.PP
It has two major components while storing the non\-zero elements, as
explained below along with the number of rows and the number of columns
in the sparse matrix.
.IP
.nf
\f[C]
val:\ a\ vector\ containing\ the\ left\-shifted\ (zero\-padded)\ non\-zero\ elements\ of\ 
the\ sparse\ matrix\ stored\ in\ column\-major\ order.\ \ \ 
idx:\ a\ vector\ containing\ the\ corresponding\ column\ indices\ of\ the\ non\-zero\ elements.\ \ \ \ 
\f[]
.fi
.PP
For example, if we consider the below sparse matrix:
.IP
.nf
\f[C]
1\ 0\ 0\ 0\ 2\ 0\ 0\ 4
0\ 0\ 0\ 1\ 2\ 0\ 0\ 3
1\ 0\ 0\ 0\ 2\ 0\ 0\ 4
0\ 0\ 0\ 1\ 2\ 0\ 0\ 3
\f[]
.fi
.PP
Then its ELL image can be thought of as:
.IP
.nf
\f[C]
values\ \ \ \ \ \ \ \ indices
1\ 2\ 4\ \ \ \ \ \ \ \ \ \ 0\ 4\ 7
1\ 2\ 3\ \ \ =>\ \ \ \ \ 3\ 4\ 7
1\ 2\ 4\ \ \ \ \ \ \ \ \ \ 0\ 4\ 7
1\ 2\ 3\ \ \ \ \ \ \ \ \ \ 3\ 4\ 7
\f[]
.fi
.PP
And its column\-major memory representation would be:
.IP
.nf
\f[C]
val:\ {1,\ 1,\ 1,\ 1,\ 2,\ 2,\ 2,\ 2,\ 4,\ 3,\ 4,\ 3}\ \ \ \ 
idx:\ {0,\ 3,\ 0,\ 3,\ 4,\ 4,\ 4,\ 4,\ 7,\ 7,\ 7,\ 7}\ \ \ \ 
\f[]
.fi
.PP
\f[C]ell_matrix<T,I>\f[] is a two\-dimensional template based
distributed sparse data storage supported by frovedis.
It contains public member "data" of the type
\f[C]node_local<ell_matrix_local<T,I>>\f[].
The actual distributed matrices are contained in all the worker nodes
locally, thus named as \f[C]ell_matrix_local<T,I>\f[] (see manual of
ell_matrix_local) and "data" is the reference to these local matrices at
worker nodes.
It also contains dimension information related to the global matrix
i.e., number of rows and number of columns in the original sparse
matrix.
.PP
The structure of this class is as follows:
.IP
.nf
\f[C]
template\ <class\ T,\ class\ I=size_t>
struct\ ell_matrix\ {
\ \ frovedis::node_local<ell_matrix_local<T,I>>\ data;\ \ \ //\ local\ matrix\ information
\ \ size_t\ num_row;\ \ \ //\ number\ of\ rows\ in\ the\ global\ sparse\ matrix
\ \ size_t\ num_col;\ \ \ //\ number\ of\ columns\ in\ the\ global\ sparse\ matrix
};
\f[]
.fi
.PP
For example, if the above sparse matrix with 4 rows and 8 columns is
distributed row\-wise over two worker nodes, then the distribution can
be shown as:
.IP
.nf
\f[C]
master\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ worker0\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ worker1
\-\-\-\-\-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \-\-\-\-\-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \-\-\-\-\-
ell_matrix<int,size_t>\ \ \ \ \->\ ell_matrix_local<int,size_t>\ \ \->\ ell_matrix_local<int,size_t>
\ \ \ *data:\ node_local<\ \ \ \ \ \ \ \ \ val:\ vector<int>\ \ \ \ \ \ \ \ \ \ \ \ \ \ val:\ vector<int>
\ \ \ \ \ \ \ \ \ ell_matrix\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ({1,1,2,2,4,3})\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ({1,1,2,2,4,3})
\ \ \ \ \ \ \ \ \ \ \ \ _local<int,\ \ \ \ \ \ \ idx:\ vector<size_t>\ \ \ \ \ \ \ \ \ \ \ idx:\ vector<size_t>
\ \ \ \ \ \ \ \ \ \ \ \ \ \ size_t>>\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ({0,3,4,4,7,7})\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ({0,3,4,4,7,7})
\ \ \ \ num_row:\ size_t\ (4)\ \ \ \ \ \ \ local_num_row:\ size_t\ (2)\ \ \ \ \ local_num_row:\ size_t\ (2)
\ \ \ \ num_col:\ size_t\ (8)\ \ \ \ \ \ \ local_num_col:\ size_t\ (8)\ \ \ \ \ local_num_col:\ size_t\ (8)
\f[]
.fi
.PP
The \f[C]node_local<ell_matrix_local<int,size_t>>\f[] object "data" is
simply a (*)handle of the (\->)local matrices at worker nodes.
.PP
This matrix can be loaded from a distributed crs matrix and also the
matrix can be converted back to the distributed crs matrix.
Thus loading/saving interfaces are not provided for distributed ell
matrix.
.SS Constructor Documentation
.SS ell_matrix ()
.PP
This is the default constructor which creates an empty distributed ell
matrix without any memory allocation at worker nodes.
.SS ell_matrix (\f[C]crs_matrix<T,I,O>\f[]& m)
.PP
This is the implicit conversion constructor to construct a distributed
ell matrix from the input distributed crs matrix of the same "val" and
"idx" type.
.SS Public Member Function Documentation
.SS \f[C]crs_matrix<T,I,O>\f[] to_crs()
.PP
This method can be used to convert the target distributed ell matrix
into a distributed crs matrix of the same "val" and "idx" type.
.SS void debug_print ()
.PP
It prints the information related to the ELL storage (val, idx, number
of rows and number of columns) of the local matrices node\-by\-node on
the user terminal.
It is mainly useful for debugging purpose.
.SS Public Data Member Documentation
.SS data
.PP
An instance of \f[C]node_local<ell_matrix_local<T,O>>\f[] type to
contain the reference information related to local matrices at worker
nodes.
.SS num_row
.PP
A size_t attribute to contain the total number of rows in the 2D matrix
view.
.SS num_col
.PP
A size_t attribute to contain the total number of columns in the 2D
matrix view.
.SH SEE ALSO
.PP
crs_matrix, jds_matrix, ell_matrix_local
